﻿using System;
using Tao.OpenGl;
using PacMan3D.Utils;

namespace PacMan3D.Objects
{
    public class Axis : IRenderable
    {
        private Size AxisSize;

        public Axis(Size axisSize)
        {
            this.AxisSize = axisSize;
        }

        public override void DrawObject()
        {
            Gl.glPushMatrix();
            
            RGBAColor xAxis = new RGBAColor(StandardColors.Red, 1.0f);
            Gl.glColor4f(xAxis.Red, xAxis.Green, xAxis.Blue, xAxis.Alpha);

            // parte positiva de X
            Gl.glBegin(Gl.GL_LINES);
            Gl.glVertex3f(0, 0, 0);
            Gl.glVertex3f(this.AxisSize.XLenght, 0, 0);
            Gl.glEnd();


            RGBAColor yAxis = new RGBAColor(StandardColors.Green, 1.0f);
            Gl.glColor4f(yAxis.Red, yAxis.Green, yAxis.Blue, yAxis.Alpha);

            // parte positiva de Y
            Gl.glBegin(Gl.GL_LINES);
            Gl.glVertex3f(0, 0, 0);
            Gl.glVertex3f(0, this.AxisSize.YLenght, 0);
            Gl.glEnd();


            RGBAColor zAxis = new RGBAColor(StandardColors.Blue, 1.0f);
            Gl.glColor4f(zAxis.Red, zAxis.Green, zAxis.Blue, zAxis.Alpha);

            Gl.glBegin(Gl.GL_LINES);
            Gl.glVertex3f(0, 0, 0);
            Gl.glVertex3f(0, 0, this.AxisSize.ZLenght);
            Gl.glEnd();

            Gl.glPopMatrix();
        }
    }
}
